// ColourText.cpp : implementation file
//

#include "stdafx.h"
#include "ColourText.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CColourText

CColourText::CColourText()
{
    Init(RGB(198,0,128),GetSysColor(COLOR_MENU));
}

CColourText::CColourText(COLORREF c)
{
    Init(c,GetSysColor(COLOR_MENU));
}

CColourText::CColourText(COLORREF fg,COLORREF bg)
{
    Init(fg,bg);
}

CColourText::~CColourText()
{
}


BEGIN_MESSAGE_MAP(CColourText, CStatic)
	//{{AFX_MSG_MAP(CColourText)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColourText message handlers

HBRUSH CColourText::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	// TODO: Change any attributes of the DC here
	pDC->SetTextColor(m_Fg);
    pDC->SetBkColor(m_Bg);
	
	// TODO: Return a non-NULL brush if the parent's handler should not be called
	pDC->SetBkMode(OPAQUE);
	return (HBRUSH)GetStockObject(NULL_BRUSH);
}

void CColourText::Init(COLORREF fg,COLORREF bg)
{
    m_Fg = fg;  // default colour is black
    m_Bg = bg;
}

void CColourText::SetTextColour(COLORREF c)
{
    m_Fg = c;
}

COLORREF CColourText::GetTextColour()
{
    return m_Fg;
}

void CColourText::SetText(char *str)
{
    SetWindowText(str);
}

void CColourText::SetText(CString str)
{
    SetWindowText(str);
}

void CColourText::SetBkColour(COLORREF c)
{
    m_Bg = c;
}

